package com.fun.feifun.modules.business.model.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;


@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class BusinessSummaryPage implements Serializable  {

    @ApiModelProperty(value = "类型 1 用户 2 供货商")
    private Integer type;

    @ApiModelProperty(value = "支付状态 支付中，支付成功，支付失败")
    private Integer payState;

    @ApiModelProperty(value = "订单创建时间区间")
    private List<String> createTimeRange;

    @ApiModelProperty(value = "用户编码")
    private String businessUserCode;

    @ApiModelProperty(value = "用户名称")
    private String businessUserNike;

    @ApiModelProperty(value = "商品编码")
    private String goodsCode;

    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    @ApiModelProperty(value = "供货商编码")
    private String supplierCode;

    @ApiModelProperty(value = "供货商名称")
    private String supplierName;

    @ApiModelProperty(value = "订单编号")
    private String code;



    @ApiModelProperty(value = "页码")
    private int page=1;

    @ApiModelProperty(value = "分页数量")
    private int size=10;

    @ApiModelProperty(value = "排序字段")
    private String sort="id";

    @ApiModelProperty(value = "排序类型")
    private boolean isASC=true;

    private int offSet=(page-1)*size;

    public int getSize() {
        if(size==0)
            return 10;
        return size;
    }
    public int getPage() {
        if(page==0)
            return 1;
        return page;
    }

    private String title;
    public String getTitle() {
        if(type==1)
            return title=" business_user_id as id ,business_user_code as code,business_user_nike  as name";
        return title=" supplier_id as id,supplier_code as code,supplier_name as name";
    }

    private String groupBy;
    public String getGroupBy() {
        if(type==1)
            return groupBy=" business_user_id,business_user_code,business_user_nike ";
        return groupBy=" supplier_id,supplier_code,supplier_name ";
    }
}
